package com.bdqn.biz;

import com.bdqn.dao.BaseDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "Newdel", value = "/Newdel")
public class Newdel extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        String id=request.getParameter("id");
        //根据ID 删除数据库内容
        try {
            BaseDao.update("delete from newtable where id=?",new Object[]{id});
            //跳转到页面上
            response.sendRedirect("/Web1/List.jsp?index=1");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}